package com.airlines.system.dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import com.airlines.system.domain.SysMenu;

import java.util.List;

@Mapper
public interface SysMenuMapper {

    int deleteByPrimaryKey(String id);

    int insert(SysMenu record);

    int insertSelective(SysMenu record);

    SysMenu selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(SysMenu record);

    int updateByPrimaryKey(SysMenu record);


    /**查找某一个角色所有的一二级菜单*/
    @Select("SELECT * from T_SYS_MENU  where  ID  in (SELECT rm.MENU_ID from T_SYS_ROLE_MENU rm where rm.ROLE_ID = #{roleId} ) and STATUS='1' ORDER BY MENU_SORT")
    @ResultMap("com.airlines.system.dao.SysMenuMapper.BaseResultMap")
    List<SysMenu> findByRoleId(@Param("roleId") String roleId);

    /**查找某一个系统所有的一二级菜单*/
    @Select("SELECT * from T_SYS_MENU  where  type_id = #{typeId}  ORDER BY MENU_SORT")
    @ResultMap("com.airlines.system.dao.SysMenuMapper.BaseResultMap")
    List<SysMenu> findMenuByType(@Param("typeId")String typeId);
}